// 创建一个路由器，并暴露出去
// 第一步：引入createRouter
import {createRouter, createWebHistory} from 'vue-router'
// 引入一个一个可能要呈现组件
import Index from '@/views/admin/Index.vue'
import UserIndex from '@/views/user/Index.vue'
import Login from '@/views/Login.vue'
import Admin from '@/views/admin/Admin.vue'
import Course from '@/views/admin/Course.vue'
import UserCourse from '@/views/user/Course.vue'
import Coach from '@/views/admin/Coach.vue'
import Chart from '@/views/admin/Chart.vue'
import Role from '@/views/admin/Role.vue'
import Permission from "@/views/admin/Permission.vue";
import User from "@/views/admin/User.vue";

//创建路由器
const router = createRouter({
    history: createWebHistory(),
    routes: [
        {path: '/login', component: Login},
        {
            path: '/', component: Index, children: [
                {path: '/admin', component: Admin},
                {path: '/role', component: Role},
                {path: '/permission', component: Permission},
                {path: '/course', component: Course},
                {path: '/coach', component: Coach},
                {path: '/chart', component: Chart},
                {path: '/user', component: User}
            ]
        },
        {
            path: '/userIndex', component: UserIndex, children: [
                {path: '/userCourse', component: UserCourse},
                {path: '/coach', component: Coach},
                {path: '/chart', component: Chart}
            ]
        }
    ]
})

// 暴露出去router
export default router